#include "stage02.h"

int stage02::GetLeftItemNum()
{
	return itemNum;
}
Type stage02::CrashCheck(SDL_Rect pos)
{
	if((pos.y ==  (40 - 1)*5 || pos.y == (60 - 1)*5) && pos.x <= (130 - 1)*5 && pos.x >= (30 - 1)*5 )
		return WALL;
	if(pos.y == itemPos.y && pos.x == itemPos.x ){
		if(--itemNum > 0)
		{
			itemPos.x = ((rand() % 50)+1)*5; 
			itemPos.y = ((rand() % 30)+1)*5;
		}
		return ITEM;
	}
	return NOTHING;

}
void stage02::Render(SDL_Surface* screen)
{
	//wall_Tile
	SDL_Rect dstrect;	

	for(int w_i = 30 ; w_i <= 130 ; w_i++)
	{
		dstrect.x = (w_i - 1)*5; 
		dstrect.y = (40 - 1)*5;
		SDL_BlitSurface(wall_Tile, NULL, screen, &dstrect );
		dstrect.y = (60 - 1)*5;
		SDL_BlitSurface(wall_Tile, NULL, screen, &dstrect );
	}
	if(itemNum>0)
		SDL_BlitSurface(item_Tile, NULL, screen, &itemPos );
}